import { TestingModule } from '@nestjs/testing';
import { CreateSignupService } from 'src/modules/player-signup/service/createSignup';
import { generateEventMock } from 'src/test/mock/mockEvent';
import { generatePlayerSignupMock } from 'src/test/mock/mockPlayerSignup';
import { getTestModule } from 'src/test/utils/unit-test/getTestModule';
// import { getConfirmE2PParam } from './createSignup';

let service: CreateSignupService;
beforeAll(async () => {
  const module: TestingModule = await getTestModule();
  service = module.get<CreateSignupService>(CreateSignupService);
});

describe('createSignup', () => {
  // let service: CreateSignupService;
  // beforeEach(async () => {
  //   const module: TestingModule = await getTestModule();

  //   service = module.get<CreateSignupService>(CreateSignupService);
  // });

  it('should be defined', () => {
    expect(service).toBeDefined();
  });
});

describe('getConfirmE2PParam', () => {
  it('testSingle', () => {
    const testList = [
      generatePlayerSignupMock({
        _order: 0,
        event: generateEventMock({ id: 1, type: 1 }),
        eventId: 1,
        id: 1,
      }),
      generatePlayerSignupMock({
        _order: 1,
        event: generateEventMock({ id: 1, type: 1 }),
        eventId: 1,
        id: 2,
      }),
      generatePlayerSignupMock({
        _order: 0,
        event: generateEventMock({ id: 2, type: 1 }),
        eventId: 2,
        id: 3,
      }),
      generatePlayerSignupMock({
        _order: 4,
        event: generateEventMock({ id: 2, type: 1 }),
        eventId: 2,
        id: 4,
      }),
      generatePlayerSignupMock({
        _order: 0,
        event: generateEventMock({ id: 3, type: 1 }),
        eventId: 3,
        id: 5,
      }),
      generatePlayerSignupMock({
        _order: -1,
        event: generateEventMock({ id: 3, type: 1 }),
        eventId: 3,
        id: 6,
      }),
    ];
    const res = service.getConfirmE2PParam(testList);
    expect(res).toEqual([
      [1, { 0: [1], 1: [2] }],
      [2, { 0: [3], 4: [4] }],
      [3, { 0: [5] }],
    ]);
  });
});
